import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author 孤风雪影
 * @Email gitee.com/efairy520
 * @Date 2023/11/17 12:21
 * @Version 1.0
 */
public class leecode_88 {
    public static void main(String[] args) {
        leecode_88 leecode88 = new leecode_88();
        int[] num1 = new int[]{1,2,3,0,0,0};
        int m = 3;
        int[] num2 = new int[]{2,5,6};
        int n = 3;
        leecode88.merge(num1,m,num2,n);
    }

    public void merge(int[] nums1, int m, int[] nums2, int n) {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < m; i++) {
            list.add(nums1[i]);
        }
        for (int i = 0; i < n; i++) {
            list.add(nums2[i]);
        }
        list = list.stream().sorted(Integer::compareTo).collect(Collectors.toList());
        System.out.println("list = " + list);
        for (int i = 0; i < nums1.length; i++) {
            System.out.println(list.get(i));
            nums1[i] = list.get(i);
        }
        // for (int i : nums1) {
        //     nums1[i] = list.get(i);
        // }
    }
}
